
# 参考http://www.ityouknow.com/springboot/2017/11/11/springboot-jenkins.html

# 旧的应用停止掉

stop_old(){
    # todo
    local dir=$1
    local jarName=$2
    find find $dir -name '$2'    
    ps -ef | grep $JARFILE | grep -v grep | awk '{print $2}' | xargs kill -9
}


local oldJar=$1
local latestJar=$2
local port =$3
# stop_old $1 $2

# 取最新的 jar
run_latest $latestJar $port


# 找到最新版本并启动
run_latest(){
local port =$2
local jar=$1
nohup java -Dserver.port=$port -Dspring.profiles.active=product -Xmx1024m  -Xss512k -XX:PermSize=128m -XX:MaxPermSize=128m -jar $jar & 
}